<template>
	<view class="combody">
		<view class="drugbox">
			<view class="drugcard" v-for="(item,index) in drugList" :key="index" >
				<!-- <image :src="baseUrl+item.icon" mode="item.name" style="width: 343rpx;height: 346rpx;" ></image> -->
				<img @click="todrugdetail(item.id)" :src="baseUrl+item.icon" mode="item.name" style="width: 343rpx;height: 346rpx;" >
				<view class="" style="padding: 0 16rpx;">
					<view @click="todrugdetail(item.id)" class="color303b39 fz34 fwbold lineclamp1" style="line-height: 48rpx;">
						{{item.name}}
					</view>
					<view class="fz28 lineclamp2" style="font-weight: 500;margin-top: 24rpx;color: #576260;line-height: 40rpx;" >
						{{ changeStr(item.adaptationdisease1) }}
					</view>
					<view @click="todrugdetail(item.id)" class="mt25 fz28 justify-center align-center" style="width: 100%;height: 60rpx;background: #EDFCF9;color: #00977C;">
						点击查看中文说明书
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import config from '@/config'
	export default{
		props:['drugList'],
		data(){
			return{
				baseUrl:config.baseUrl,
			}
		},
		methods:{
			todrugdetail(id){
				uni.navigateTo({
					url: '/pages/knowledge/drugdetail?id='+id
				});
			},
			// 转化为无格式文本
			changeStr(str){
				if (str) {
					let words = str.replace(/<[^<>]+>/g, "").replace(/&nbsp;/gi, "")
					str = words.replace(/\s/g, "")
					return str;
				}
			}
			
		}
		
	}
</script>

<style lang="scss" scoped>
	.combody{
		.drugbox{
			margin-top: 14rpx;
			display: flex;
			justify-content: space-between;
			flex-wrap: wrap;
			.drugcard{
				width: 343rpx;
				background: #fff;
				margin-bottom: 16rpx;
				padding-bottom: 32rpx;
			}
		}
	}
</style>